From c2a28ee6acc69aef35e02a348dbcb3e1bd28a9bc Mon Sep 17 00:00:00 2001 From: "jchesterfield@dhcp92.uk.xensource.com" Date: Wed, 6 Sep 2006 11:42:29 +0100 Subject: [PATCH] [BLKTAP] Fix in xend to properly destroy blktap devices when deviceClass=='tap' Submitted by Andres Lagar Cavilla --- tools/python/xen/xend/XendDomainInfo.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 7505e44f97..033d92ffc4 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -1087,6 +1087,15 @@ class XendDomainInfo: ## public: def destroyDevice(self, deviceClass, devid): + if type(devid) is str: + devicePath = '%s/device/%s' % (self.dompath, deviceClass) + for entry in xstransact.List(devicePath): + backend = xstransact.Read('%s/%s' % (devicePath, entry), "backend") + devName = xstransact.Read(backend, "dev") + if devName == devid: + # We found the integer matching our devid, use it instead + devid = entry + break return self.getDeviceController(deviceClass).destroyDevice(devid) -- 2.30.2